﻿package com.calefk.core   {
	
	import flash.display.MovieClip;

	public class TemporaryManager {
		
		private var mList:List;
		private var mCanvas:MovieClip;
		
		public function get canvas():MovieClip {
			return mCanvas;
		}
		
		public function TemporaryManager(canvas:MovieClip) {
			mCanvas = canvas;
			mList = new List();
		}
		
		public function addTemporary(nameClip:String , px:Number = 0 , py:Number = 0 , functionEnd:Function = null, 
				newcanvas:MovieClip = null):void {
			if (newcanvas == null) {
				newcanvas = mCanvas;
			}
			var item:Temporary = new Temporary(newcanvas , nameClip , px , py , functionEnd);
			mList.add(item);
			
		}
		
		public function addObjectTemporary(item:Temporary):void {
			mList.add(item);
		}
		
		public function update(dt:int):void {
			mList.update(dt);
		}
		
		public function clean():void {
			mList.clean();
			mList = null;
			mCanvas = null;
		}
	}
}